package com.faneui.transfer.common.code;

public enum OrderStatusEnum {

	pay(2, "等待支付"), pay_process(3, "支付中"), pay_success(4, "支付完成"), pay_failed(5, "支付失败"), consumer(6,
			"等待消费"), consumer_process(7, "消费中"), consumer_success(8, "消费完成完成"), consumer_failed(9, "消费失败"), refund(10,
					"等待退款"), refund_process(11, "消费完成"), refund_success(12,
							"退款完成"), refund_failed(13, "退款失败"), success(14, "订单成功"), close(15, "订单关闭");

	private final int code;
	private final String desc;

	private OrderStatusEnum(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public int getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

	public static OrderStatusEnum getEnumByCode(int code) {
		 if (code == 2) {
			return pay;
		} else if (code == 3) {
			return pay_process;
		} else if (code == 4) {
			return pay_success;
		} else if (code == 5) {
			return pay_failed;
		} else if (code == 6) {
			return consumer;
		} else if (code == 7) {
			return consumer_process;
		} else if (code == 8) {
			return consumer_success;
		} else if (code == 9) {
			return consumer_failed;
		} else if (code == 10) {
			return refund;
		} else if (code == 11) {
			return refund_process;
		} else if (code == 12) {
			return refund_success;
		} else if (code == 13) {
			return refund_failed;
		} else if (code == 14) {
			return success;
		} else if (code == 15) {
			return close;
		} else {
			return null;
		}
	}

}
